home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / scsiDiskBoot / RCS / devProbe.s,v < prev    next >
Encoding:
Text File  |  1989-06-08  |  2.5 KB  |  143 lines

  1. head     1.2;
  2. access   ;
  3. symbols  ;
  4. locks    ; strict;
  5. comment  @# @;
  6.  
  7.  
  8. 1.2
  9. date     86.07.17.09.03.45;  author brent;  state Exp;
  10. branches ;
  11. next     1.1;
  12.  
  13. 1.1
  14. date     86.07.17.08.41.23;  author brent;  state Exp;
  15. branches ;
  16. next     ;
  17.  
  18.  
  19. desc
  20. @Peek and Poke devices
  21. @
  22.  
  23.  
  24. 1.2
  25. log
  26. @Dev_ names
  27. @
  28. text
  29. @|* devProbe.s -
  30. |*
  31. |*      Subroutines to probe for a device.
  32. |*
  33. |* Copyright (C) 1985 Regents of the University of California
  34. |* All rights reserved.
  35. |*
  36.  
  37. |*
  38. |* Temporary BusError handler to protect Dev_Peek and Dev_Poke
  39. |*
  40.  
  41. BusErr:
  42.     moveq    #-1,d0        | Need to return -1.
  43.     movl    a1,sp        | Restore the stack.
  44.     movl    d1,8:w        | Restore bus error handler
  45.     rts
  46.  
  47. |*
  48. |* ----------------------------------------------------------------------------
  49. |*
  50. |* Dev_Peek --
  51. |*
  52. |*      Read a short from the device.  Return -1 if didn't work (ie, the
  53. |*    address caused a bus error) otherwise return the short that was read.
  54. |*
  55. |*      int Dev_Peek(addr)
  56. |*          Address    addr;
  57. |*
  58. |* Results:
  59. |*     The contents of *addr.
  60. |*
  61. |* Side effects:
  62. |*     None.
  63. |*
  64. |* ----------------------------------------------------------------------------
  65. |*
  66.  
  67.     .text
  68.     .globl    _Dev_Peek
  69. _Dev_Peek:
  70.     movl    sp@@(4),a0    | Get address to read into a register.
  71.     movl    sp,a1        | Save the stack pointer
  72.     movl    8:w,d1        |    and the bus error handler.
  73.     movl    #BusErr,8:w    | Set up a bus error handler.
  74.     clrl    d0        | Clear d0.
  75.     movw    a0@@,d0        | Read a short.
  76.     movl    d1,8:w        | Restore the bus handler and return the short.
  77.     rts
  78.  
  79. |*
  80. |* ----------------------------------------------------------------------------
  81. |*
  82. |* Dev_Poke --
  83. |*
  84. |*      Write a short to the device.  Return -1 if it didn't work.
  85. |*
  86. |*      int Dev_Poke(addr, value)
  87. |*          Address    addr;
  88. |*        short    value;
  89. |*
  90. |* Results:
  91. |*     -1 if an error.
  92. |*
  93. |* Side effects:
  94. |*     None.
  95. |*
  96. |* ----------------------------------------------------------------------------
  97. |*
  98.  
  99.     .text
  100.     .globl    _Dev_Poke
  101. _Dev_Poke:
  102.     movl    sp@@(4),a0    | Get address to write into a register.
  103.     movl    sp,a1        | Save the stack pointer
  104.     movl    8:w,d1        |    and the bus error handler.
  105.     movl    #BusErr,8:w    | Set up a bus error handler.
  106.     movw    sp@@(10), d0    | Get value to write.
  107.     movw    d0, a0@@        | Write the short.
  108.     movl    d1,8:w        | Restore the bus handler and return 0.
  109.     clrl    d0
  110.     rts
  111. @
  112.  
  113.  
  114. 1.1
  115. log
  116. @Initial revision
  117. @
  118. text
  119. @d10 1
  120. a10 1
  121. |* Temporary BusError handler to protect DevPeek and DevPoke
  122. d22 1
  123. a22 1
  124. |* DevPeek --
  125. d27 1
  126. a27 1
  127. |*      int DevPeek(addr)
  128. d40 2
  129. a41 2
  130.     .globl    _DevPeek
  131. _DevPeek:
  132. d54 1
  133. a54 1
  134. |* DevPoke --
  135. d58 1
  136. a58 1
  137. |*      int WriteDev(addr, value)
  138. d72 2
  139. a73 2
  140.     .globl    _DevPoke
  141. _DevPoke:
  142. @
  143.